package com.lms.admin.config;

import com.lms.admin.api.SysUserClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.support.WebClientAdapter;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;

@Configuration
public class WebConfig {
    @Bean
    WebClient webClient() {
        return WebClient.builder().baseUrl("http://lms-cloud:9731/admin").build();
    }

    @Bean
    SysUserClient sysUserClient() {
        HttpServiceProxyFactory httpServiceProxyFactory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient())).build();
        return httpServiceProxyFactory.createClient(SysUserClient.class);
    }
}
